<!DOCTYPE html>
<html lang="en" ng-app="myApp">

<head>
    <meta charset="UTF-8">
    <title>{{'AngularJS'}}</title>
    <script type="text/javascript" src="//cdn.bootcss.com/angular.js/1.4.5/angular.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
</head>

<body>
    <h1 ng-init="name = 'tt'">Hello, {{name || 'AngularJS'}}</h1>
    <input type="text" ng-model="name" placeholder="Enter name here" />
    <h1>First Controller</h1>
    <div ng-controller="firstController">
        <input type="button" ng-click="fetchData()" value="Fetch JSON Data" />
        <p>
            Response :
            <br/>
            <textarea name="" id="" cols="100" rows="10" disabled>{{resp}}</textarea>
        </p>
        <p>
            Data :
            <br/>
            <textarea name="" id="" cols="100" rows="10" disabled>{{data}}</textarea>
        </p>
        <h3>循环显示数据</h3>
        <ul>
            <li ng-repeat="obj in data">Name : {{obj.name}}, Age : {{obj.age}}</li>
        </ul>
        <ul>
            <li ng-repeat="(index, obj) in data">Index : {{index}}, Name : {{obj.name}}, Age : {{obj.age}}</li>
        </ul>
        
    </div>
</body>

</html>
